package com.seed.core.configuration.relation;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.seed.core.enumeration.Cascade;
import com.seed.core.pojo.seed.HasOnes;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class HasOneConfiguration extends BelongsToConfiguration {
    protected Cascade cascade;

    public HasOnes toHasOne() {
        HasOnes ret = new HasOnes();
        ret.setTargetSeedName(seedName);
        ret.setLabel(label);
        ret.setComment(comment);
        ret.setSelfColumn(selfColumn);
        ret.setTargetColumn(targetColumn);
        ret.setCascade(cascade);
        ret.setExtra(extra);

        return ret;
    }

    public HasOneConfiguration toFront() {
        HasOneConfiguration ret = new HasOneConfiguration();
        ret.setSeedName(seedName);
        ret.setLabel(label);
        ret.setComment(comment);
        ret.setExtra(extra);

        return ret;
    }

    public Cascade getCascade() {
        return cascade;
    }

    public void setCascade(Cascade cascade) {
        this.cascade = cascade;
    }
}
